﻿<UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="Atha.Clients.Silverlight.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="800">

    <UserControl.Resources>
        <sdk:HierarchicalDataTemplate x:Key="TestResultTemplate">
            <StackPanel Orientation="Horizontal">
                <Image Source="{Binding IconPath, Mode=OneTime}" />
                <TextBlock Text="{Binding Text, Mode=OneTime}" Margin="5,0,0,0" />
            </StackPanel>
        </sdk:HierarchicalDataTemplate>
        <Style TargetType="Button">
            <Setter Property="MinWidth" Value="80" />
        </Style>
        <Style TargetType="ComboBox">
            <Setter Property="MinWidth" Value="80" />
        </Style>
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel>
            <StackPanel Orientation="Horizontal">
                <Button DataContext="{Binding OpenTests}" Content="{Binding Text, Mode=OneWay, FallbackValue=Refresh}" Command="{Binding ClickCommand, Mode=OneWay}" />
                <Button DataContext="{Binding OpenTest}" Content="{Binding Text, Mode=OneWay, FallbackValue=Open}" Command="{Binding ClickCommand, Mode=OneWay}" />
                <Button DataContext="{Binding SaveTest}" Content="{Binding Text, Mode=OneWay, FallbackValue=Save}" Command="{Binding ClickCommand, Mode=OneWay}" />
                <ComboBox ItemsSource="{Binding Languages, Mode=OneTime}" SelectedItem="{Binding SelectedLanguage, Mode=TwoWay}" SelectedValuePath="Text" DisplayMemberPath="Text" />
                <Button DataContext="{Binding ExecuteTest}" Content="{Binding Text, Mode=OneWay, FallbackValue=Execute}" Command="{Binding ClickCommand, Mode=OneWay}" />
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <ListBox ItemsSource="{Binding TestScripts, Mode=OneWay}" SelectedValuePath="Title" DisplayMemberPath="Title" SelectedItem="{Binding SelectedTestScript, Mode=TwoWay}" Width="150" SelectionMode="Single" />
                <sdk:TreeView ItemsSource="{Binding TestResults, Mode=OneWay}" ItemTemplate="{StaticResource TestResultTemplate}" Width="150" />
                <TextBox Text="{Binding TestScript, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="600" AcceptsReturn="True" Height="300" />
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>
